home *** CD-ROM | disk | FTP | other *** search
/ Delphi Informant Complete 1995 - 2000 / Delphi Informant Complete 1995 to 2000.iso / Delphi Informant Magazine Complete Works SOURCE CODE 1995.rar / 1995 / JUL / MC9507 / calc_f.pas < prev    next >
Pascal/Delphi Source File  |  1995-06-01  |  1KB  |  48 lines

  1. unit Calc_f;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   StdCtrls, Forms, DBCtrls, DB, DBGrids, DBTables, Grids, ExtCtrls;
  8.  
  9. type
  10.   TCalcForm = class(TForm)
  11.     DBGrid1: TDBGrid;
  12.     DBNavigator: TDBNavigator;
  13.     Panel1: TPanel;
  14.     Panel2: TPanel;
  15.     DataSource1: TDataSource;
  16.     Table1: TTable;
  17.     Table1Name: TStringField;
  18.     Table1Capital: TStringField;
  19.     Table1Area: TFloatField;
  20.     Table1Population: TFloatField;
  21.     Table1PopulationDensity: TFloatField;
  22.     procedure FormCreate(Sender: TObject);
  23.     procedure Table1CalcFields(DataSet: TDataset);
  24.   private
  25.     { private declarations }
  26.   public
  27.     { public declarations }
  28.   end;
  29.  
  30. var
  31.   CalcForm: TCalcForm;
  32.  
  33. implementation
  34.  
  35. {$R *.DFM}
  36.  
  37. procedure TCalcForm.FormCreate(Sender: TObject);
  38. begin
  39.   Table1.Open;
  40. end;
  41.  
  42. procedure TCalcForm.Table1CalcFields(DataSet: TDataset);
  43. begin
  44.   Table1PopulationDensity.Value :=
  45.     Table1Population.Value / Table1Area.Value;
  46. end;
  47.  
  48. end.